/**
 * 全站路由配置
 *
 * 建议:
 * 1. 代码中路由统一使用name属性跳转(不使用path属性)
 */
import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载
const _import = require('./import-' + process.env.NODE_ENV)

const globalRoutes = [
    // { path: '/404', component: _import('common/404'), name: '404', meta: { title: '404未找到' } },
    // { path: '/login', component: _import('common/login'), name: 'login', meta: { title: '登录' } },
    // { path: '/userlogin', component: _import('common/userlogin'), name: 'userlogin', meta: { title: '用户登录' } },
    { 
        path: '/message', component: _import('mymodules/message/message'), name: 'message', meta: { title: '消息' } ,
    //   children: [
    //     { path: '/detail', component: _import('mymodules/message/message-detail'), name: 'message-detail', meta: { title: '具体消息' } },
    //     { path: '/list', component: _import('mymodules/message/message-list'), name: 'message-list', meta: { title: '消息列表' } },
    //   ],
    },
  ]

const router2 = new Router({
    mode: 'hash',
    scrollBehavior: () => ({ y: 0 }),
    isAddDynamicMenuRoutes: false, // 是否已经添加动态(菜单)路由
    routes: globalRoutes
  })

export default router2